<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    // let obj = {
    //     name : 'LIER',
    //     age : 18,
    //     gender : '男',
    //     id : 9
    // }
    // console.log(obj.__proto__)
    // console.dir(obj)
    function obj(name, age, gender, id) {
        this.name = name;
        this.age = age;
        this.gender = gender;
        this.id = id;
        this.sayHi = function () {
            console.log('我叫' + this.name + ',今年' + this.age + '歲,性別是' + this.gender + '生');
        }
    }
    // obj.prototype.sayHi = function(){
    //     console.log('我叫'+this.name+',今年'+this.age+'歲,性別是'+this.gender+'生');
    // }
    let s1 = new obj('狗蛋', 18, '男', 9);
    s1.sayHi();
    console.log(s1.sayHi())
    let s2 = new obj('翠花', 17, '女', 10);
    s2.sayHi();
    console.log(s2.sayHi());
    // console.log(s1.sayHi === s2.sayHi)
    // console.log(s1.sayHi() === s2.sayHi())
    // function add(a, b) {
    //     return a + b;
    // }
    // add(10,20)
    // // console.log(add)
    // function fn(){
    // }
    // console.log(fn());
    // console.log(fu())
    function Star(uname, age) {
        this.uname = uname;
        this.age = age;
    }
    // Star.prototype.uname = "张学友";
    // Star.prototype.sing = function () {
    //     console.log('我会唱歌');
    // }
    // var ldh = new Star('刘德华', 18);
    // console.log(ldh.uname)
    // ldh.sing();
    function Star(uname, age) { }
    let ldh = new Star('刘德华', 18)
    console.log(ldh.__proto__ == Star.prototype)
    console.log(Star.prototype.constructor == Star)
    console.log(ldh.__proto__.constructor == Star)
</script>

</html>